package com.limbo.showapp.presenter;

import com.limbo.showapp.base.BaseBean;
import com.limbo.showapp.base.BasePresenter;
import com.limbo.showapp.model.LoginModel;
import com.limbo.showapp.rxHttp.HttpObserver;
import com.limbo.showapp.view.IHttpView;

/**
 * Created by wangqi on 2018/9/11.
 */

public class LoginPresenter extends BasePresenter<IHttpView,LoginModel> {

    @Override
    protected LoginModel getModel() {
        return new LoginModel();
    }

    public void login(String password){
        mModel.login(password, new HttpObserver<BaseBean>() {
            @Override
            protected void onHttpError(Throwable e) {
                if (getView() != null)
                    getView().onError(e.getMessage());
            }

            @Override
            protected void onHttpSuccess(BaseBean bean) {
                if (getView() != null)
                    getView().onSuccess(bean);
            }
        });
    }
}
